/*
WSCatalogWrapper.java

Copyright (c) 2007 Pontifical Catholic University of Rio de Janeiro, Brazil

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
 */
package br.pucrio.inf.cmm.wrappers;

import java.net.URL;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.endpoint.ClientImpl;

import br.pucrio.inf.csm.Attribute;
import br.pucrio.inf.csm.CatalogAccessException;
import br.pucrio.inf.csm.ICatalogWrapper;
import br.pucrio.inf.csm.ISchema;
import br.pucrio.inf.csm.Instance;

/**
 * 
 * @author agazola
 *
 */
public class WSCatalogWrapper implements ICatalogWrapper {

	private static Logger logger = Logger.getLogger(JDBCCatalogWrapper.class
			.getName());

	public WSCatalogWrapper(Map<String, String> parameters)
			throws CatalogAccessException {
		
		
	}

	@Override
	public List<Instance> getInstancesByThesaurusTerm(String term,
			ISchema schema) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int getSimilarityCount(ISchema schema, Attribute schemaAttr,
			String value) throws CatalogAccessException {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<String> getThesaurus(ISchema schema)
			throws CatalogAccessException {
		// TODO Auto-generated method stub
		return null;
	}
	
	public static void main(String[] args) throws Exception {
		URL url = new URL(
			 "http://twoninemedia.com/webServiceExample/webService.cfc?wsdl");
		URL amazonURL = new URL(
				"http://soap.amazon.com/schemas2/AmazonWebServices.wsdl");
		
		URL googleSearchUrl = new URL("http://api.google.com/GoogleSearch.wsdl");
		
		URL quoteUrl = new URL(
				"http://www.webservicex.net/stockquote.asmx?WSDL");
		
		URL weatherUrl = new URL(
				"http://www.webservicex.net/globalweather.asmx?wsdl");
		
		URL currencyConverterUrl = new URL(
				"http://www.webservicex.net/CurrencyConvertor.asmx?WSDL");
		
		url = currencyConverterUrl;
		
		
		Client client = new ClientImpl(url);
		Object[] results = client.invoke("ConversionRate", new Object[] {
				"BRL", "UGX" });

		// Service returns a double of the currency conversion rate.
		System.out.println((Double) results[0]);
	}

}
